import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'

import VueRouter from 'vue-router'
import axios from 'axios'
import Vuex from 'vuex'

import YDUI from 'vue-ydui'; /* 相当于import YDUI from 'vue-ydui/ydui.rem.js' */
import 'vue-ydui/dist/ydui.rem.css';
import {Slider, SliderItem} from 'vue-ydui/dist/lib.rem/slider';
import 'vue-ydui/dist/ydui.base.css';

import infiniteScroll from 'vue-infinite-scroll';
Vue.use(infiniteScroll);

// 安装vuex
Vue.use(Vuex);
// 安装路由
Vue.use(VueRouter);

Vue.use(YDUI);


//设置$axios全局变量
Vue.prototype.$axios = axios

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
});

router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next();
});
